import time

from selenium.webdriver.common.by import By

from Pages import BasePage


class BaseOperate(BasePage.Action):

    def __init__(self):
        #订单详情页复制按钮
        self.copyOrderNo_xpath = (By.XPATH, "//span[text()='复制']")

        #重要通告弹框关闭
        self.closeNotice_xpath = (By.XPATH,"//div[text() = '重要公告']/../../div/span")


    def getOrderNo(self):
        orderNo = self.find_element(*self.copyOrderNo_xpath).get_attribute("data-clipboard-text")
        return orderNo

    #弹框判断
    def closeNotice(self):
        time.sleep(5)
        if self.Element_displayed(*self.closeNotice_xpath):
            self.find_element(*self.closeNotice_xpath).click()